app.controller('fenleiCtrl', function($scope, $http) {
	$scope.fenlei_aaa = 111
	$scope.aaa = 111

//	$('.bar_span').eq(0).addClass('color')
	$('.bar_span').each(function(ins) {
		$(this).click(function() {
			//		console.log(ins)
			$(this).addClass('color').parents().siblings().children().removeClass('color')
		})
	})
	//	http://api.chuchujie.com/api?client={"ageGroup":"AG_0to24","channel":"QD_web_webkit","deviceId":"0","gender":"0","imei":"0","packageName":"com.culiu.purchase","platform":"wap","sessionId":"0","shopToken":"0","userId":"0","version":"1.0","xingeToken":""}
	//&query={"module":"search","function":"v3","sort":"favcount_desc"}

	$('.jingxuan').addClass('baco')

	function show2() {
		$http.get('/api/api', {
			params: {
				client: {
					"ageGroup": "AG_0to24",
					"channel": "QD_web_webkit",
					"deviceId": "0",
					"gender": "0",
					"imei": "0",
					"packageName": "com.culiu.purchase",
					"platform": "wap",
					"sessionId": "0",
					"shopToken": "0",
					"userId": "0",
					"version": "1.0",
					"xingeToken": ""
				},
				query: {
					"module": "search",
					"function": "v3",
					"sort": "favcount_desc"
				}
			}
		}).then(function(res) {
			//		console.log(res)
			$scope.fenlei = res.data

		})

		//	$('.bar_span').eq(0).addClass('color')
		//$('.bar_span').each(function(ins) {
		//	$(this).click(function  () {
		////		console.log(ins)
		//      $(this).addClass('color').parents().siblings().children().removeClass('color')
		//	})
		//})

		$scope.fenleiShow1 = function() {
			$scope.fenlei_aaa = 111
			show2()
		}

		$scope.fenleiShow2 = function() {
			$scope.fenlei_aaa = 222

			$http.get('/api/api', {
				//		http://api.chuchujie.com/api?client={"ageGroup":"AG_0to24","channel":"QD_web_webkit","deviceId":"0","gender":"0","imei":"0","packageName":"com.culiu.purchase","platform":"wap","sessionId":"0","shopToken":"0","userId":"0","version":"1.0","xingeToken":""}
				//		&query={"module":"search","function":"v3","sort":"favcount_desc"}&sort=soldQuantity_desc
				params: {
					client: {
						"ageGroup": "AG_0to24",
						"channel": "QD_web_webkit",
						"deviceId": "0",
						"gender": "0",
						"imei": "0",
						"packageName": "com.culiu.purchase",
						"platform": "wap",
						"sessionId": "0",
						"shopToken": "0",
						"userId": "0",
						"version": "1.0",
						"xingeToken": ""
					},
					query: {
						"module": "search",
						"function": "v3",
						"sort": "favcount_desc"
					},
					sort: 'soldQuantity_desc'
				}
			}).then(function(res) {
				//		console.log(res)
				$scope.fenlei2 = res.data

			})

		}

		$scope.fenleiShow3 = function() {
			$scope.fenlei_aaa = 333

			$http.get('/api/api', {
				params: {
					client: {
						"ageGroup": "AG_0to24",
						"channel": "QD_web_webkit",
						"deviceId": "0",
						"gender": "0",
						"imei": "0",
						"packageName": "com.culiu.purchase",
						"platform": "wap",
						"sessionId": "0",
						"shopToken": "0",
						"userId": "0",
						"version": "1.0",
						"xingeToken": ""
					},
					query: {
						"module": "search",
						"function": "v3",
						"sort": "favcount_desc"
					},
					sort: "addtime_desc"
				}
			}).then(function(res) {
				console.log(res)
				$scope.fenlei3 = res.data

			})

		}

		$scope.fenleiShow4 = function() {
			$scope.fenlei_aaa = 444
			//	http://api.chuchujie.com/api?client={"ageGroup":"AG_0to24","channel":"QD_web_webkit","deviceId":"0","gender":"0","imei":"0","packageName":"com.culiu.purchase","platform":"wap","sessionId":"0","shopToken":"0","userId":"0","version":"1.0","xingeToken":""}&query={"module":"search","function":"v3","sort":"favcount_desc"}&sort=price_asc
			$http.get('/api/api', {
				params: {
					client: {
						"ageGroup": "AG_0to24",
						"channel": "QD_web_webkit",
						"deviceId": "0",
						"gender": "0",
						"imei": "0",
						"packageName": "com.culiu.purchase",
						"platform": "wap",
						"sessionId": "0",
						"shopToken": "0",
						"userId": "0",
						"version": "1.0",
						"xingeToken": ""
					},
					query: {
						"module": "search",
						"function": "v3",
						"sort": "favcount_desc"
					},
					sort: "price_asc"
				}
			}).then(function(res) {
				console.log(res)
				$scope.fenlei4 = res.data

			})

		}

	}

	show2()
	$('.fen_women').click(function() {
		$(this).addClass('baco')
		$('.fen_men').removeClass('baco')
		$scope.aaa = 111
		show2()

	})

	$('.fen_men').click(function() {

//		console.log(222)
		$(this).addClass('baco')
		$('.fen_women').removeClass('baco')
		$scope.aaa = 222
		$http.get('/api/api', {
			//		http://api.chuchujie.com/api?client={"ageGroup":"AG_0to24","channel":"QD_web_webkit","deviceId":"0","gender":"1","imei":"0","packageName":"com.culiu.purchase","platform":"wap","sessionId":"0","shopToken":"0","userId":"0","version":"1.0","xingeToken":""}&query={"module":"search","function":"v3","sort":"favcount_desc"}
			params: {
				client: {
					"ageGroup": "AG_0to24",
					"channel": "QD_web_webkit",
					"deviceId": "0",
					"gender": "1",
					"imei": "0",
					"packageName": "com.culiu.purchase",
					"platform": "wap",
					"sessionId": "0",
					"shopToken": "0",
					"userId": "0",
					"version": "1.0",
					"xingeToken": ""
				},
				query: {
					"module": "search",
					"function": "v3",
					"sort": "favcount_desc"
				}
			}
		}).then(function(res) {
			//		console.log(res)
			$scope.fenlei2 = res.data

		})

		$scope.fenleiShow1 = function() {
			$scope.fenlei_aaa = 111
			$http.get('/api/api', {
				//		http://api.chuchujie.com/api?client={"ageGroup":"AG_0to24","channel":"QD_web_webkit","deviceId":"0","gender":"1","imei":"0","packageName":"com.culiu.purchase","platform":"wap","sessionId":"0","shopToken":"0","userId":"0","version":"1.0","xingeToken":""}&query={"module":"search","function":"v3","sort":"favcount_desc"}
				params: {
					client: {
						"ageGroup": "AG_0to24",
						"channel": "QD_web_webkit",
						"deviceId": "0",
						"gender": "1",
						"imei": "0",
						"packageName": "com.culiu.purchase",
						"platform": "wap",
						"sessionId": "0",
						"shopToken": "0",
						"userId": "0",
						"version": "1.0",
						"xingeToken": ""
					},
					query: {
						"module": "search",
						"function": "v3",
						"sort": "favcount_desc"
					}
				}
			}).then(function(res) {
				//		console.log(res)
				$scope.fenlei2 = res.data

			})
		}

		$scope.fenleiShow2 = function() {
			$scope.fenlei_aaa = 222

			$http.get('/api/api', {

				params: {
					client: {
						"ageGroup": "AG_0to24",
						"channel": "QD_web_webkit",
						"deviceId": "0",
						"gender": "1",
						"imei": "0",
						"packageName": "com.culiu.purchase",
						"platform": "wap",
						"sessionId": "0",
						"shopToken": "0",
						"userId": "0",
						"version": "1.0",
						"xingeToken": ""
					},
					query: {
						"module": "search",
						"function": "v3",
						"sort": "favcount_desc"
					},
					sort: 'soldQuantity_desc'
				}
			}).then(function(res) {
				//		console.log(res)
				$scope.fenlei2 = res.data

			})

		}

		$scope.fenleiShow3 = function() {
			$scope.fenlei_aaa = 333
			//	http://api.chuchujie.com/api?client={"ageGroup":"AG_0to24","channel":"QD_web_webkit","deviceId":"0","gender":"1","imei":"0","packageName":"com.culiu.purchase","platform":"wap","sessionId":"0","shopToken":"0","userId":"0","version":"1.0","xingeToken":""}&query={"module":"search","function":"v3","sort":"favcount_desc"}&sort=addtime_desc
			$http.get('/api/api', {
				params: {
					client: {
						"ageGroup": "AG_0to24",
						"channel": "QD_web_webkit",
						"deviceId": "0",
						"gender": "1",
						"imei": "0",
						"packageName": "com.culiu.purchase",
						"platform": "wap",
						"sessionId": "0",
						"shopToken": "0",
						"userId": "0",
						"version": "1.0",
						"xingeToken": ""
					},
					query: {
						"module": "search",
						"function": "v3",
						"sort": "favcount_desc"
					},
					sort: "addtime_desc"
				}
			}).then(function(res) {
				//		console.log(res)
				$scope.fenlei3 = res.data

			})

		}

		$scope.fenleiShow4 = function() {
			$scope.fenlei_aaa = 444
			http: //api.chuchujie.com/api?client={"ageGroup":"AG_0to24","channel":"QD_web_webkit","deviceId":"0","gender":"1","imei":"0","packageName":"com.culiu.purchase","platform":"wap","sessionId":"0","shopToken":"0","userId":"0","version":"1.0","xingeToken":""}&query={"module":"search","function":"v3","sort":"favcount_desc"}&sort=price_asc
				$http.get('/api/api', {
					params: {
						client: {
							"ageGroup": "AG_0to24",
							"channel": "QD_web_webkit",
							"deviceId": "0",
							"gender": "1",
							"imei": "0",
							"packageName": "com.culiu.purchase",
							"platform": "wap",
							"sessionId": "0",
							"shopToken": "0",
							"userId": "0",
							"version": "1.0",
							"xingeToken": ""
						},
						query: {
							"module": "search",
							"function": "v3",
							"sort": "favcount_desc"
						},
						sort: "price_asc"
					}
				}).then(function(res) {
					//		console.log(res)
					$scope.fenlei4 = res.data

				})

		}

	})

})